home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Simple Slideshow / TIFF code folder / tiffinfo.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-09  |  2.8 KB  |  104 lines  |  [TEXT/KAHL]

  1. /*
  2.  * an interface for using TIFF files with QuickDraw.
  3.  */
  4.  
  5.  
  6. /*
  7.  * record of relevant information gained by scanning the TIFF fields.
  8.  */
  9.  
  10.  
  11. /*
  12.  * this is from the TIFF 5.0 document of 8/8/88
  13.  */
  14.  
  15. /* first eight bytes of a TIFF file: */
  16. struct TIFFHeader{
  17.     short byteOrder;        /* 0x4949: little-endian; 0x4d4d: big-endian */
  18.     short versionNumber;    /* always 42 */
  19.     unsigned long offset;    /* to first Image File Directory */
  20. };
  21.  
  22. #define LittleEndian 0x4949
  23. #define BigEndian 0x4d4d
  24.  
  25. /*
  26.  * an Image File Directory has 2 bytes with the number of entries,
  27.  * then the entries, then 4 bytes of offset to the next IFD, or 0.
  28.  */
  29. struct TIFFEntry{
  30.     short tag;
  31.     short type;        /* TIFF_BYTE, TIFF_ASCII, TIFF_SHORT, TIFF_LONG, TIFF_RATIONAL */
  32.     long length;    /* really a count */
  33.     long offset;    /* offset in file, or value if <= 4 bytes */
  34. };
  35.  
  36. #define TIFF_BYTE    1    /* 8-bit unsigned integer */
  37. #define TIFF_ASCII    2    /* ascii string; last byte is null */
  38. #define TIFF_SHORT    3    /* 16 bit unsigned integer */
  39. #define TIFF_LONG    4    /* 32-bit unsigned integer */
  40. #define TIFF_RATIONAL 5    /* two longs: numerator, denominator */
  41.  
  42. /* the entry types */
  43. #define ColorMap        320
  44. #define NewSubfileType    254
  45. #define ImageWidth        256
  46. #define ImageLength        257
  47. #define BitsPerSample    258
  48. #define Compression        259
  49. #define  NoCompression    1
  50. #define  LZWCompression    5
  51. #define  PackCompression 32773
  52. #define PhotometricInterpretation    262
  53. #define  PIZeroIsWhite    0
  54. #define  PIZeroIsBlack    1
  55. #define  PIRGB            2
  56. #define  PIPalette        3
  57. #define StripOffsets    273
  58. #define SamplesPerPixel    277
  59. #define RowsPerStrip    278
  60. #define StripByteCounts    279
  61. #define XResolution        282
  62. #define YResolution        283
  63. #define PlanarConfiguration    284
  64. #define  PCContiguous    1    /* RGBRGB... */
  65. #define  PCPlanar        2    /* RR...GG...BB... */
  66. #define ResolutionUnit    296
  67. #define Predictor        317
  68. #define  NoPredictor    1
  69. #define  HDPredictor    2
  70.  
  71.  
  72. struct TIFFInfo{
  73.     short ref; /* Mac file reference */
  74.     short byteOrder; /* LittleEndian or BigEndian */
  75.     long offset; /* of this Image File Directory */
  76.     long nextOffset; /* of next Image File Directory */
  77.     OSErr err;
  78.     Str255 errStr;
  79.     
  80.     long *bitsPerSample; /* [samplesPerPixel] */
  81.     CTabHandle colorMap;
  82.     long compression;
  83.     long predictor;
  84.     long imageLength;
  85.     long imageWidth;
  86.     long photometricInterpretation;
  87.     long planarConfiguration;
  88.     long rowsPerStrip;
  89.     long samplesPerPixel;
  90.     long *stripByteCounts;
  91.     long stripsPerImage;
  92.     long *stripOffsets; /* [# of strips] */
  93. };
  94. typedef struct TIFFInfo *TIFFPtr;
  95.  
  96.  
  97. TIFFPtr                 ScanTIFF            (short ref);
  98. void                     DisposeTIFF            (TIFFPtr);
  99. OSErr                     DrawTIFF            (short ref, TIFFPtr ti, Rect sr, Rect dr, short dither);
  100. OSErr                     GetTIFFError        (TIFFPtr, StringPtr);
  101. short                     UnLZW                (char *in, long inlen, char *out, long outlen);
  102. Boolean                 TIFFDrawable        (TIFFPtr ti);
  103. PixMapHandle             PalettePixMap        (short depth, CTabHandle cth, long x, long y, long width, long height,
  104.                                                   Ptr data, long row);